<?php
/**
 * Project: AIGC
 * Author: moufer <moufer@163.com>
 * Date: 2024/7/19 01:05
 */

namespace module\user\front\table;

use mof\front\Table;

class ScoreLogTable extends Table
{
    protected string $serverBaseUrl  = '/{module}/admin/{table}';
    protected array  $toolbarButtons = ['refresh', 'search'];
    protected bool $tableSelection = false;

    public function operation(): array
    {
        return [
            'show'    => false,
            'buttons' => [],
        ];
    }

    protected function columnUserId(): array
    {
        return [
            "prop"   => 'user_id',
            "label"  => '用户ID',
            "search" => true,
            "width"  => 120
        ];
    }

    protected function columnNickName(): array
    {
        return [
            "prop"  => 'user.nickname',
            "label" => '用户昵称',
            "width" => '*'
        ];
    }

    protected function columnType(): array
    {
        return [
            "prop"    => 'flow',
            "label"   => '流向',
            "type"    => "select",
            "options" => [
                ['value' => 'in', 'label' => '收入'],
                ['value' => 'out', 'label' => '支出'],
            ],
            "search"  => true,
            "width"   => 140
        ];
    }

    protected function columnScore(): array
    {
        return [
            "prop"  => 'score',
            "label" => '积分',
            "width" => 120
        ];
    }

    protected function columnAfter(): array
    {
        return [
            "prop"  => 'after',
            "label" => '剩余',
            "width" => 120
        ];
    }

    protected function columnRemark(): array
    {
        return [
            "prop"  => 'remark',
            "label" => '备注',
            "width" => '*'
        ];
    }

    protected function columnCreatedAt(): array
    {
        return [
            "prop"   => 'create_at',
            "label"  => '记录时间',
            "type"   => "datetime",
            "search" => [
                "type" => "daterange",
            ]
        ];
    }

}